<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/6/24
 * Time: 16:08
 */
$classId = $_GET['class_id'] ?? '';

// 从数据库删除 $classId 的班级
$dsn = "sqlsrv:Server=localhost;Database=Student";
$db = new PDO($dsn, "sa", "123456");

$sql = "delete from Class where ClassId='{$classId}'";
$result = $db->exec($sql);
var_dump($db->errorInfo());
if ($result) {
    echo '删除成功，前往<a href="list.php">列表页</a>';
} else {
    echo '删除失败';
}
